package com.catchu.pattern.creational.构造器模式.bill;

/**
 * 国内账单生成器
 */
public class DemosticBillBuilder implements IBillBuilder {

    /**
     * 国内账单
     */
    private DemosticBill bill = new DemosticBill();

    @Override
    public void buildBasicPrice(float basicPrice) {
        bill.basicPrice = basicPrice;
        bill.total+=basicPrice;
    }

    @Override
    public void buildTax() {

    }

    @Override
    public void buildFreight() {
        float freight = bill.basicPrice > 50 ? 0:10;
        bill.freight = freight;
        bill.total+=freight;
    }

    @Override
    public void buildDiscount() {
        bill.discount = bill.basicPrice > 100?20:0;
    }

    @Override
    public Object getBill() {
        return bill;
    }
}
